﻿
@model YouWei.Infrastructure.Entity.Company

@{
    ViewBag.Title = "企业详情";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<section class="content-header">
    <h1>
        企业详情
        <small></small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i>主页</a></li>
        <li class="active">企业详情</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header">
                    <table class="table table-striped">
                        <tr>
                            <td>企业名称</td>
                            <td>@Model.CompanyName</td>

                        </tr>
                        <tr>
                            <td>联系人</td>
                            <td>@Model.ContactUser</td>
                            <td>联系电话</td>
                            <td>@Model.ContactMobile</td>
                        </tr>
                        <tr>
                            <td>创建人</td>
                            <td>@Model.CreateUserID</td>
                            <td>创建时间</td>
                            <td>@Model.CreateDate.ToString("yyyy-MM-dd HH:mm")</td>
                        </tr>
                        @if (Model.UpdateDate.Year > 1900 && Model.UpdateUserID > 0)
                        {
                            <tr>
                                <td>更新人</td>
                                <td>@Model.UpdateUserID</td>
                                <td>更新时间</td>
                                <td>@Model.UpdateDate.ToString("yyyy-MM-dd HH:mm")</td>

                            </tr>
                        }
                        <tr>
                            <td>省市区</td>
                            <td>@Model.Proince @Model.City @Model.Location</td>
                            <td>详细地址</td>
                            <td>@Model.Address</td>
                        </tr>
                        <tr>
                            <td>企业简介</td>
                            <td>@Model.CompanyDesc</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>

        <div class="col-md-12">
            <h3> 企业用户</h3>
            <div class="box box-primary">
                <div class="box-header">
                    <form id="search-form" class="form-inline">
                        <div class="form-group">
                            <label>电话</label>
                            <input type="text" class="form-control" style="width:100px;" maxlength="11" name="Mobile" autocomplete="off" />
                        </div>
                        <div data-toggle="distpicker" class="form-group">
                            <label>所在地</label>
                            <select name="HProince" id="HProince" class="form-control"></select>
                            <select name="HCity" id="HCity" class="form-control"></select>
                        </div>
                        <div class="form-group">
                            <label>微信号</label>
                            <input type="text" class="form-control" style="width:100px;" name="WeChartNum" autocomplete="off" />
                        </div>
                        <div class="form-group">
                            <label>创建时间</label>
                            <input type="text" class="form-control" style="width:100px;" name="BCreateDate" id="BCreateDate" autocomplete="off" />
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" style="width:100px;" name="ECreateDate" id="ECreateDate" autocomplete="off" />
                        </div>
                        <div class="form-group">
                            <button type="button" class="btn btn-success btn-sm" id="btnSearch">查找</button>
                        </div>

                        <h3 class="box-title"></h3>
                    </form>
                </div>
                <!-- /.box-header -->
                <div class="box-body table-responsive no-padding" id="parData">
                </div>
                <div class="box-footer clearfix ">
                    <ul id="pagination" class="pagination pagination-sm no-margin pull-right"></ul>
                </div>
            </div>
        </div>

    </div>
</section>

@section scriptsBottom{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#BCreateDate").datepicker({
                language: "zh-CN",
                autoclose: true,//选中之后自动隐藏日期选择框
                format: "yyyy-mm-dd"//日期格式，
            });
            $("#ECreateDate").datepicker({
                language: "zh-CN",
                autoclose: true,//选中之后自动隐藏日期选择框
                format: "yyyy-mm-dd"//日期格式，
            });
            $("#btnSearch").click(function () {
                pageIndex = 1;
                list();
            });
            list();
        });

        //页码
        var pageIndex = 1;
        //查询
        function list() {
            var fdata = $("#search-form").serializeJson();
            var url = '@Url.Action("ParUserList", "Company")' + "?page=" + pageIndex +"&companyId="+@ViewBag.ID;
            //查询列表
            BMCW.ajax({
                url: url,
                type: 'POST',
                data: fdata,
                dataType: "html",
                success: function (data) {
                    document.getElementById('parData').innerHTML = data;
                    //分页显示
                    $('#pagination').twbsPagination("destroy");
                    $('#pagination').twbsPagination({
                        totalItems: document.getElementById('total').value,
                        visiblePages: 10,
                        pageSize: 10,
                        startPage: parseInt(pageIndex),
                        onPageClick: function (event, page) {
                            pageIndex = page;
                            list();
                        }
                    });
                }
            });
        }

        function detail(id) {
            var url = '@Url.Action("Detail", "User")' + "?userId=" + id;
            window.open( url);
    }
    </script>
}